import requests
from bs4 import BeautifulSoup

headers = {
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
}

def get_movie_name(page: int) -> None:
  resp = requests.get(f'https://movie.douban.com/top250?start={page * 25}&filter=', headers=headers)

  # print(resp.status_code)
  # print(resp.text)
  soup = BeautifulSoup(resp.text, 'html.parser')

  divs = soup.find_all('div', attrs={'class': 'hd'})

  for div in divs:
    span = div.find('span', attrs={'class': 'title'})
    print(span.string)


for i in range(10):
  get_movie_name(i)
